# 69 字符串
# my_str = 'wenxiaojian and hanlei'
# value = my_str[2]
# value2 = my_str[-20]
# print(value)
# print(value2)
#
# value = my_str.index('and')
# print(value)
#
# new_my_str = my_str.replace('hanlei', 'Hanlei')
# print(new_my_str)
#
# my_str = 'wenxiaojian and hanlei and love'
# my_str_list = my_str.split(" ")
# print(my_str_list)
#
# my_str = '  wenxiaojian and hanlei and love  '
# my_str_list = my_str.strip()
# print(my_str_list)
#
# my_str = '123wenxiaojian and hanlei and love321'
# my_str_list = my_str.strip('123')
# print(my_str_list)
#
# my_str = 'wenxiaojian and hanlei and love'
# my_str_list = my_str.count('a')
# print(my_str_list)
#
# my_str = 'wenxiaojian and hanlei and love'
# my_str_list = len(my_str)
# print(my_str_list)

# 70 练习

# my_str = "itheima itcast boxuegu"
# new_my_list = my_str.count("it")
# print(new_my_list)
#
# new_my_list = my_str.replace(" ", "|")
# print(new_my_list)
#
# new_my_list2 = new_my_list.split('|')
# print(new_my_list2)

# 71 数据容器
# my_list = [0, 1, 2, 3, 4, 5, 6]
# result1 = my_list[1:4]
# print(result1)
#
# my_tuple = (0, 1, 2, 3, 4, 5, 6)
# result2 = my_tuple[:]
# print(result2)
#
# my_str = 'wenxiaojian'
# result3 = my_str[::2]
# print(result3)
#
# my_str = '01234567'
# result4 = my_str[::-1]
# print(result4)
#
# my_list = [0, 1, 2, 3, 4, 5, 6]
# result5 = my_list[3:1:-1]
# print(result5)
#
# my_tuple = (0, 1, 2, 3, 4, 5, 6)
# result6 = my_tuple[::-2]
# print(result6)

# 72 练习
# my_tuple = '学python，来黑马程序员，月薪过万'
# new_my_tuple = my_tuple[::-1]
# print(new_my_tuple)
#
# new_my_tuple1 = new_my_tuple[::-1]
# print(new_my_tuple1)
#
# new_my_tuple2 = new_my_tuple1[9:14]
# print(new_my_tuple2)
#
# result3 = new_my_tuple.split("，")[1].replace("来", "")[::-1]
# print(result3)

# 73 集合的定义和操作
# my_set = {'wenxiaojian', 'hanlei', 'wenjie', 'lishuyi', 'wenxiaojian', 'hanlei', 'wenjie', 'lishuyi'}
# my_set_empty = set()
# print(f"{my_set},类型是：{type(my_set)}")
# print(my_set_empty)
#
# my_set.add('python')
# my_set.add('learning')
# print(my_set)
#
# my_set.remove('learning')
# print(my_set)
#
# my_set = {'wenxiaojian', 'hanlei', 'wenjie'}
# element = my_set.pop()
# print(element)
# # print(my_set)
#
# my_set.clear()
# print(my_set)
#
# set1 = {1, 2, 3}
# set2 = {1, 5, 6}
# set1.difference_update(set2)
# print(set1)
# print(set2)
#
# set1 = {1, 2, 3}
# set2 = {1, 5, 6}
# set3 = set1.union(set2)
# print(set3)
# print(set2)
# print(set1)
#
# set1 = {1, 2, 3, 4, 5, 1, 2, 3, 4, 5}
# num = len(set1)
# print(num)
#
# set1 = {1, 2, 3, 4, 5}
# for element in set1:
#     print(element)

# 74 练习
# my_list = ['wenxiaojian', 'hanlei', 'wenjie', 'lishuyi', 'lichaoqiang', 'wenxiaojian', 'hanlei', 'wenjie', 'lishuyi',
#            'lichaoqiang']
# my_set = set()
#
# for element in my_list:
#     my_set.add(element)
# print(my_list)
# print(my_set)

# 75 字典
# my_dict1 = {'wenxiaojian': 100, 'hanlei': 80, 'wenjie': 60}
# my_dict2 = {}
# my_dict3 = dict()
# print(f"字典1的内容是：{my_dict1}, 类型：{type(my_dict1)}")
# print(f"字典2的内容是：{my_dict2}, 类型：{type(my_dict2)}")
# print(f"字典3的内容是：{my_dict3}, 类型：{type(my_dict3)}")
#
# my_dict1 = {'wenxiaojian': 88, 'hanlei': 99, 'wenxiaojian': 100}
# print(my_dict1)
#
# my_dict1 = {'wenxiaojian': 100, 'hanlei': 80, 'wenjie': 60}
# score = my_dict1['wenxiaojian']
# print(score)
#
# score = my_dict1['hanlei']
# print(score)
#
# # 字典的嵌套
# stu_score_dict = {
#     'wenxiaojian': {
#         "yuwen": 88,
#         'shuxue': 66,
#         'yingyu': 55
#     },
#     'hanlei': {
#         "yuwen": 100,
#         'shuxue': 30,
#         'yingyu': 90,
#     },
#     'wenjie': {
#         "yuwen": 78,
#         'shuxue': 34,
#         'yingyu': 67,
#     },
# }
# print(f"学生的考试信息是：{stu_score_dict}")
# score = stu_score_dict['wenxiaojian']['yuwen']
# print(score)
# score = stu_score_dict['hanlei']['yingyu']
# print(score)

# 76 字典的常用操作
# my_dict = {'wenxiaojian': 100, 'hanlei': 88, 'wenjie': 77}
# my_dict['lishuyi'] = 150
# print(my_dict)
#
# my_dict['wenxiaojian'] = 120
# print(my_dict)
#
# score = my_dict.pop('lishuyi')
# print(f"字典中被移除了一个元素，结果：{my_dict},李书逸的考试分数是：{score}")
#
# my_dict.clear()
# print(my_dict)
#
# my_dict = {'wenxiaojian': 100, 'hanlei': 88, 'wenjie': 77}
# keys = my_dict.keys()
# print(keys)
#
# for key in keys:
#     print(key)
#     print(my_dict[key])
#
# for key in my_dict:
#     print(key)
#     print(my_dict[key])
#
# num = len(my_dict)
# print(num)

# 77 练习

# my_dict = {
#     'wanglihong': {
#         'bumen': 'kejibu',
#         'gongzi': 3000,
#         'jibie': 1
#     },
#     'zhoujielun': {
#         'bumen': 'shichangbu',
#         'gongzi': 5000,
#         'jibie': 2
#     },
#     'linjunjie': {
#         'bumen': 'shichangbu',
#         'gongzi': 7000,
#         'jibie': 3
#     },
#     'zhangxueyou': {
#         'bumen': 'kejibu',
#         'gongzi': 4000,
#         'jibie': 1
#     },
#     'liudehua': {
#         'bumen': 'shichangbu',
#         'gongzi': 6000,
#         'jibie': 2
#     },
#
# }
# print(f"全体员工的信息如下：{my_dict}")
# for name in my_dict:
#     if my_dict[name]['jibie'] == 1:
#         employee_info_dict = my_dict[name]
#         employee_info_dict['jibie'] = 2
#         employee_info_dict['gongzi'] += 1000
#         my_dict[name] = employee_info_dict
# print(my_dict)

# 78 总结
